Previous Book Contents Book Index Next

Inside Macintosh: QuickTime /
Chapter 3 - Image Compression Manager / Image Compression Manager Reference
Image Compression Manager Functions / Working With Pictures and PICT Files


DrawTrimmedPictureFile

The DrawTrimmedPictureFile function draws an image that is stored as a picture file (PICT file) into the current graphics port and trims that image to fit a region you specify.

pascal OSErr DrawTrimmedPictureFile (short srcRefnum, 
                              const Rect *frame, 
                              RgnHandle trimMask, 
                              short doDither,
                              ProgressProcRecordPtr progressProc);
srcRefNum
Contains a file reference number for the source PICT file.
frame
Contains a pointer to the rectangle into which the decompressed image is to be loaded.
trimMask
Contains a handle to a clipping region in the destination coordinate system. The decompressor applies this mask to the destination image and ignores any image data that fall outside the specified region. Set this parameter to nil if you do not want to clip the source image. In this case, this function acts like the DrawPictureFile function, which is described on page 3-92.
doDither
Indicates whether to dither the image. Use this parameter to indicate whether you want the image to be dithered when it is displayed on a lower-resolution screen. The following constants are available:
defaultDither

Indicates that the dithering in the source picture file is to be respected.
forceDither
Indicates that the specified image should be dithered whether the source uses dithering or not.
suppressDither
Indicates that dithering should not be used in any case. The ability to suppress dithering can be useful if, for example, you have a 32-bit color JPEG image drawn into an 8-bit buffer with a custom color table from the image. In that case, dithering would not be necessary and probably not desirable, particularly if the buffer were to be compressed with the graphics compressor.
progressProc
Points to a progress function structure. During the compression operation, the compressor may occasionally call a function you provide in order to report its progress (see "Progress Functions" beginning on page 3-146 for more information about progress functions). If you have not provided a progress function, set this parameter to nil. If you pass a value of -1, you obtain a standard progress function.
DESCRIPTION
The DrawTrimmedPictureFile function works with compressed image data--the source data stays compressed. The function trims the image to fit the specified clipping region. The Image Compression Manager handles any spooling issues that may arise when reading the picture file.

You can use this function to save part of a picture, since the image data that is not within the trim region is ignored and is not included in the destination picture file. All the reamining objects in the resulting object are clipped.

RESULT CODES
noErr0No error
paramErr-50Invalid parameter specified
memFullErr-108Not enough memory available
codecAbortErr-8967Operation aborted by the progress function
File Manager errors


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996